<template>
	<view class="">
		<u-navbar title="核查记录" back-icon-color="#fff"
			:background="{backgroundImage: 'linear-gradient(45deg, #68dae7, #21a4b3)'}" title-color="#FFFFFF">
		</u-navbar>
		<view class="list-item" v-if="!isNodata">
			<view v-for="(item, index) in checkList" :key="index" @tap="gotoInfo(item.id)">
				<view class="list-item-info">
					<view class="list-item-info-title">
						<view class="list-item-info-title-left">
							<view class="list-item-info-title-left-time">
								{{item.deviceName}}
							</view>
						</view>
					</view> 
					<view class="list-item-info-text">
						<view>核查结果：{{item.checkRecord}}</view>
					</view>
					<view class="list-item-info-bottom">
						<view class="footerTime">核查时间：{{item.checkTime}}</view>
						<view class="hospitalName">核查人：{{item.checkBy}}</view>
					</view>
				</view>
			</view>
			<view class="no-more-data" v-if="isReach">
				已经全部加载完了
			</view>
		</view>
		<view class="list-nodata" v-else>
			<image src="@/static/images/nodata.png"></image>
			<view class="list-nodata-text">暂无数据</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				checkList:[],
				deviceId:null,
				isReach:false,
				isNodata:false
			}
		},
		onLoad(options) {
			this.deviceId = options.deviceSn
			this.getData()
		},
		onPullDownRefresh() {
			this.checkList = []
			this.getData()
		},
		methods:{
			getData(){
				let params = {
					deviceId:this.deviceId
				}
				this.$xt.api.checklist(params).then(res=>{
					this.checkList = res.rows
					if(this.checkList.length == 0) this.isNodata = true
				})
			},
			gotoInfo(id){
				this.$u.route({
					url:'pages/home/checkInfo',
					type:"navigateTo",
					params:{
						id:id
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.list-item{
		width: 750rpx;
		background-color: #F5F7FB;
		padding-top: 1rpx;
		padding-bottom: 10rpx;
		&-info{
			background-color: #fff;
			margin: 20rpx 0 0  0;
			padding: 10rpx 24rpx;
			&-title{
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding-bottom: 10rpx;
				&-left{
					display: flex;
					align-items: center;
					&-time{
						font-size: 32rpx;
						// height: 24rpx;
					}
				}
			}
			&-text{
				height: 180rpx;
				background: #F5F7FB;
				border-radius: 10rpx 10rpx 10rpx 10rpx;
				padding: 5rpx 5rpx;
				font-size: 28rpx;
			}
			&-bottom{
				display: flex;
				justify-content: space-between;
				margin-top: 10rpx;
				font-size: 24rpx;
				.hospitalName{
					color:#49B9AD
				}
			}
		}
	}
	.item-con{
		overflow: auto;
	}
	.no-more-data{
		text-align: center;
		padding-top: 5rpx;
		padding-bottom: 10rpx;
		font-size: 20rpx;
		color:#ccc
	}
	.list-nodata{
		width: 750rpx;
		height: 50vh;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		image{
			width: 250rpx;
			height: 250rpx;
		}
		&-text{
			margin-top: 10rpx;
			color:#666
		}
	}
</style>